import { connect } from 'dva'
import React, { Component } from 'react'
import request from '../utils/request'

class Film extends Component {
    componentDidMount() {
        request('https://m.maizuo.com/gateway?cityId=310100&pageNum=1&pageSize=10&type=1&k=4497002',
            {
                headers: {
                    'X-Client-Info': '{"a":"3000","ch":"1002","v":"5.2.1","e":"16786109221404153658081281","bc":"310100"}',
                    'X-Host': 'mall.film-ticket.film.list'
                }
            }).then(res => console.log(res))

        this.props.dispatch({
            type: 'maizuo/hide'
        })
        // this.props.dispatch({
        //     type: 'maizuo/getCinemaList'
        // })
    }

    getRequest() {
        request('users/login', {
            methods: 'POST',
            body: JSON.stringify({ username: '123', password: '13132121' }),
            headers: {
                'Content-Type': 'application/json'
            }
        }).then(res => {
            console.log(res)
        })
    }
    render() {
        return (
            <div>
                <div onClick={() => {
                    this.getRequest()
                }}>tarbar {this.props.isShow && '1111'}</div>
            </div>
        )
    }
}

//高级封装 入公共参数
export default connect((state) => {
    return {
        a: 1,
        isShow: state.maizuo.isShow
    }
})(Film)